﻿@{
    ViewBag.Title="用户入口";
    ViewBag.CopyRight = false;

}
<div class="login">
    <h3>您尚未登录</h3>
    <a class="btn btn-warning btn-block"  id="register">注 册</a>
    <a class="btn btn-primary btn-block" id="login">绑 定</a>
    <div id="skipArea" class="hide">
        <h5>您还可以： <a href="javascript:;" class="red" id="skip">一键注册</a></h5>
        <p><i class="glyphicon glyphicon-info-sign"></i> 系统将为您随机生成一个账号和初始密码</p>
    </div>
</div>
<style>body,html{ height:100%;}
    </style>
<script type="text/javascript">
    $(function () {

        $('.login').css('marginTop', -1 * $('.login').height() / 2);

        var openId = QueryString('openId');
        var serviceProvider = QueryString('serviceProvider');
        var headimgurl = QueryString('headimgurl');
        var returnUrl = QueryString('returnUrl');
        var appidtype = QueryString('AppidType');
        var unionid = QueryString('unionid');
        var queryString = '?openId=' + openId + '&serviceProvider=' + serviceProvider + '&AppidType=' + appidtype + '&headimgurl=' + headimgurl + '&unionid='+unionid+'&returnUrl=' + returnUrl;

        $('#login').attr('href', '/' + areaName + '/Login/BindUser' + queryString);
        $('#register').attr('href', '/' + areaName + '/Register' + queryString);


        if (serviceProvider && openId) {
            $('#skipArea').removeClass('hide');
            bindSkip();
        }
        else {
            $('#login').html('登录');

        }
    });


    function bindSkip() {
        $('#skip').click(function () {
            var openId = QueryString('openId');
            var serviceProvider = QueryString('serviceProvider');
            var realName = QueryString('realName');
            var nickName = QueryString('nickName');
            var headimgurl =QueryString('headimgurl');
            var returnUrl = QueryString('returnUrl');
            var appidtype = QueryString('AppidType');
            var unionid = QueryString('unionid');
            $.post('../Register/Skip', { openId: openId, serviceProvider: serviceProvider, realName: realName, nickName: nickName, headimgurl: headimgurl,appidtype:appidtype,unionid:unionid }, function (result) {
                if (result.success) {
                    location.href = decodeURIComponent(returnUrl);
                }
                else
                    $.dialog.alert('一键注册失败' + result.msg);
            });


        });
    }

</script>



